#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/epoll.h>
#include <time.h>
#include <signal.h>
#include "struct_common_nam.h"

int main()
{
	struct queue_message msg;

	int msg_size = sizeof(msg)-sizeof(long);
	int mq_key = ftok("key", 2000);
	int mqid = msgget(mq_key, IPC_CREAT|0644);	
	while(1)
	{
		msgrcv(mqid, &msg, msg_size, 0, 0);
		write(1, msg.buf, 1024);
		write(1, "\n", 1);
		memset(&msg, 0, sizeof(msg));
	}
}
